testsuite: Don't use gdk_cairo_get_clip_rectangle()
authorBenjamin Otte <otte@redhat.com>
Wed, 12 Feb 2020 22:44:09 +0000 (23:44 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 13 Feb 2020 05:15:44 +0000 (06:15 +0100)
I want to remove it.

testsuite/gsk/reftest-compare.c
testsuite/reftests/reftest-compare.c

index f63af72419e6ddbfe2b3c8a29ba817830290f8f5..21f5962d9c47d4cede9f1950ff88200586103611 100644 (file)
@@ -27,20 +27,19 @@ get_surface_size (cairo_surface_t *surface,
                   int             *width,
                   int             *height)
 {
-  GdkRectangle area;
   cairo_t *cr;
+  double x1, x2, y1, y2;
 
   cr = cairo_create (surface);
-  if (!gdk_cairo_get_clip_rectangle (cr, &area))
-    {
-      g_assert_not_reached ();
-    }
+  cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
+  cairo_destroy (cr);
 
-  g_assert (area.x == 0 && area.y == 0);
-  g_assert (area.width > 0 && area.height > 0);
+  g_assert (x1 == 0 && y1 == 0);
+  g_assert (x2 > 0 && y2 > 0);
+  g_assert ((int) x2 == x2 && (int) y2 == y2);
 
-  *width = area.width;
-  *height = area.height;
+  *width = x2;
+  *height = y2;
 }
 
 static cairo_surface_t *
index f63af72419e6ddbfe2b3c8a29ba817830290f8f5..dc422089cd230dc80511ac9cca501b792b7d8afc 100644 (file)
@@ -27,22 +27,22 @@ get_surface_size (cairo_surface_t *surface,
                   int             *width,
                   int             *height)
 {
-  GdkRectangle area;
   cairo_t *cr;
+  double x1, x2, y1, y2;
 
   cr = cairo_create (surface);
-  if (!gdk_cairo_get_clip_rectangle (cr, &area))
-    {
-      g_assert_not_reached ();
-    }
+  cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
+  cairo_destroy (cr);
 
-  g_assert (area.x == 0 && area.y == 0);
-  g_assert (area.width > 0 && area.height > 0);
+  g_assert (x1 == 0 && y1 == 0);
+  g_assert (x2 > 0 && y2 > 0);
+  g_assert ((int) x2 == x2 && (int) y2 == y2);
 
-  *width = area.width;
-  *height = area.height;
+  *width = x2;
+  *height = y2;
 }
 
+
 static cairo_surface_t *
 coerce_surface_for_comparison (cairo_surface_t *surface,
                                int              width,